/*
 * =====================================================================================
 *
 *       Filename:  3664.c
 *
 *    Description:  struct sorting, or top K problem
 *
 *        Version:  1.0
 *        Created:  2012年06月28日 15时20分59秒
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Regan (), lcqhigh@gmail.com
 *        Company:  
 *
 * =====================================================================================
 */
#include	<stdio.h>
#include	<stdlib.h>

struct node_s 
{
    int idx;
    int v1;
    int v2;
};

struct node_s node_list[50001];

int cmp1(const void *p1, const void *p2)
{
    return ((const struct node_s*)p2)->v1 - ((const struct node_s*)p1)->v1;
}



int main(int argc, char *argv[])
{
    int n, k;
    int i, winidx = 0;
    while (scanf("%d %d", &n, &k) == 2) {
        for (i = 0; i < n; ++i)
        {
          scanf("%d %d", &node_list[i].v1, &node_list[i].v2);
          //ignore this is wrong
          node_list[i].idx = i;
        }
        qsort(node_list, n, sizeof(node_list[0]), cmp1);
        winidx = 0;
        for (i = 1; i < k; ++i) {
            if (node_list[i].v2 > node_list[winidx].v2)
                winidx = i;
        }
        printf ( "%d\n", node_list[winidx].idx+1);
    }
    return 0;
}
